

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Criar Produto</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Listagem Produto</g:link></span>
        </div>
        <div class="body">
            <h1>Criar Produto</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${productInstance}">
            <div class="errors">
                <g:renderErrors bean="${productInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name">Nome:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'name','errors')}">
                                    <input type="text" id="name" name="name" value="${fieldValue(bean:productInstance,field:'name')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="code">Código:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'code','errors')}">
                                    <input type="text" id="code" name="code" value="${fieldValue(bean:productInstance,field:'code')}"/>
                                </td>
                            </tr> 

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="available">Disponível para venda:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'available','errors')}">
                                    <g:checkBox name="available" value="${productInstance?.available}" ></g:checkBox>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="delivery">Tempo de entrega (dias):</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'delivery','errors')}">
                                    <input type="text" id="delivery" name="delivery" value="${fieldValue(bean:productInstance,field:'delivery')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="price">Preço:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'price','errors')}">
                                    <input type="text" id="price" name="price" value="${fieldValue(bean:productInstance,field:'price')}" />
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Criar" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
